package org.gwtEss.utils;

import org.gwtEss.table.TextDesc;

public class Helper {
	public static final TextDesc getTxtBasedOnPx(TextDesc originalText, int width){
		return new TextDesc(originalText.isHtml(), getTxtBasedOnPx(originalText.getText(), width)); 
	}
	public static final String getTxtBasedOnPx(String originalText, int width){
		int allowedChars = width/8-2; 
		return originalText.length() > allowedChars?originalText.substring(0, allowedChars) + "...":originalText;
	}

}
